package com.bwie.controller;

import com.bwie.pojo.Car;
import com.bwie.service.CarService;
import com.bwie.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author GaoYiJie
 * @Description
 * @Create 2025/3/2 19:38
 * @Version 1.0
 */
@RestController
@RequestMapping("/shop/car")
public class CarController {

    @Autowired
    CarService carService;

    /**
     * 获取购物车列表
     * @return
     */
    @PostMapping("/getCarList")
    public R getCarList(){
        return carService.getCarList();
    }

    /**
     * 删除购物车商品
     * @return
     */
    @PostMapping("/deleteByCarId/{carId}")
    public R deleteByCarId(@PathVariable("carId") Integer carId){
        return carService.deleteByCarId(carId);
    }

    /**
     * 修改购物车选中状态
     * @return
     */
    @PostMapping("/updateCarSelect")
    public R updateCarSelect(@RequestBody Car car){
        return carService.updateCarSelect(car);
    }


}
